#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_exer.py
# author:Jackiex
# datetime:2023/4/20 14:24
# software: PyCharm

"""
this is function  description 
"""


# def sort_list(k):
#     k.sort(reverse=False)
#     print("paixuhou:",k)
#
#
# if __name__ == "__main__":
#     list = [1, -3, 23, -23, -34, 56, 34, 46]
#
#     sort_list(list)

'''
  2 如果我们传一个元组列表，进行排序
'''

# list = [('Tom',85),('Jack',76),('Tracy',89),('Marry',65),('Kent',90)]
#
# list_sorted = sorted(list,key=lambda x:x[1],reverse=True)
#
# print(list_sorted)


'''
  3  列表中的数据是复合数据类型--字典
'''
dict_list = [
  {'name': 'Alice', 'age': 25},
  {'name': 'Bob', 'age': 30},
  {'name': 'Charlie', 'age': 20}
]

# 按照字典中的age键的值进行排序
dict_list.sort(key=lambda x: x['age'])

# 输出排序后的结果
print(dict_list)
